package org.zjvis.datascience.common.dto.gis;

import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.zjvis.datascience.common.dto.BaseDTO;
import org.zjvis.datascience.common.util.DozerUtil;
import org.zjvis.datascience.common.vo.gis.GisTabsVO;

import java.util.List;


@Data
@NoArgsConstructor
@AllArgsConstructor
public class GisTabsDTO extends BaseDTO {
    private static final long serialVersionUID = 3026446377214303367L;

    private Long id;

    private String tabName;

    private Long userId;

    private String dataJson;

    private Long projectId;

    private Long pipelineId;

    private Long taskId;

    private Long type;
//    public GisTabsVO setTab() {
//        GisTabsVO tab = new GisTabsVO();
//        JSONObject jsonObject = JSONObject.parseObject(dataJson);
//        List<String> tbNames=
//        vo.setCategories(jsonObject.getJSONArray("categories").toJavaList(CategoryVO.class));
//        vo.setEdges(jsonObject.getJSONArray("edges").toJavaList(EdgeVO.class));
//        return vo;
//    }


    public GisTabsVO tab() {
        GisTabsVO tab = new GisTabsVO();
        tab.setProjectId(projectId);
        tab.setTabId(id);
        tab.setTabName(tabName);
        tab.setType(type);
//        JSONObject data = new JSONObject();
//        data.put("data", JSONObject.parseObject(this.dataJson));
        tab.setData(JSONObject.parseObject(dataJson));
        return tab;
    }

}
